<!--
 * @Description: 切换岗位
-->
<template>
    <el-dialog title="选择岗位" :visible="visible" width="400px" @close="onClose" @open="onOpen">
        <el-form ref="form" label-width="80px" class="form">
            <el-form-item label="岗位">
                <el-select v-model="station" placeholder="请选择">
                    <el-option v-for="item in config" :key="item.stationId" :label="item.stationName" :value="item.stationName"></el-option>
                </el-select>
            </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
            <el-button class="bottom_all_two" @click="onClose">取 消</el-button>
            <el-button class="bottom_all" type="primary" @click="onConfirm">确 定</el-button>
        </span>
    </el-dialog>
</template>

<script>
    export default {
        data() {
            return {
                station: ''
            };
        },
        props: {
            config: {
                type: Array,
                default: () => [],
            },
            // 控制dialog显示
            visible: {
                type: Boolean,
                default: false
            },
        },
        methods: {
            onOpen() {},
            onClose() {
                this.$emit('update:visible', false);
            },
            onConfirm() {
                if(!this.station) return this.$message.info("请选择岗位");
                this.$emit('updated', this.station);
                this.$emit('update:visible', false);
            },
        },
    };
</script>

<style lang="scss" scoped>
</style>
